package com.zzyl.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.zzyl.base.PageResponse;
import com.zzyl.mapper.CostomerProjectMapper;
import com.zzyl.service.CostomerProjectService;
import com.zzyl.vo.NursingPlanVo;
import com.zzyl.vo.NursingProjectVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Description CostomerProjectServiceImpl
 * @Author KangChi Wang
 * @Date 2024-08-31
 */
@Service
public class CostomerProjectServiceImpl implements CostomerProjectService {
    @Autowired
    private CostomerProjectMapper costomerProjectMapper;

    @Override
    public PageResponse<NursingProjectVo> page(Integer pageNum, Integer pageSize, String name, Integer status) {
        //开启分页查询
        PageHelper.startPage(pageNum, pageSize);
        //返回查询结果
        Page<NursingProjectVo> page = costomerProjectMapper.page(name, status);

        PageResponse<NursingProjectVo> pages = new PageResponse<>(page);
        pages.setRecords(page.getResult());
        return pages;


    }

    /**
     * 根据id查询信息
     * @param id
     * @return {@link NursingPlanVo }
     */
    @Override
    public NursingProjectVo getById(Long id) {
        NursingProjectVo Info =costomerProjectMapper.getInfoById(id);
        return Info;

    }
}
